package cn.wb.addUser;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

@Service
public class AddUser {
    @Autowired
    private AddTest addTest;

    public void addUser() throws InterruptedException {
        ExecutorService executor = Executors.newFixedThreadPool(10000);
        for (int i = 0;i<300;i++){
            executor.execute(()->addTest.addUser());
        }
        executor.awaitTermination(30, TimeUnit.SECONDS);
        executor.shutdown();

    }
}
